package com.ahyesyesteam.aicarfaultrepair.controller;


import com.ahyesyesteam.aicarfaultrepair.service.LoginService;
import com.ahyesyesteam.aicarfaultrepair.util.Response;
import com.ahyesyesteam.aicarfaultrepair.vo.params.LoginParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author SSQ
 * @since 2022-06-17
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private LoginService loginService;

    @PostMapping("login")
    public Response login(@RequestBody LoginParam loginParam){
        return loginService.login(loginParam);
    }

    @GetMapping("logout")
    public Response logout(@RequestHeader("Authorization")String token){
        return loginService.logout(token);
    }

    @PostMapping("register")
    public  Response register(@RequestBody LoginParam loginParam){
        return loginService.register(loginParam);
    }
}
